package test;

import com.tang.websocket.v1.EncoderDecoderSupport;
import org.junit.Test;
import org.springframework.core.GenericTypeResolver;
import org.springframework.core.ResolvableType;
import org.springframework.core.convert.TypeDescriptor;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Tang
 * @classname NoContext
 * @description [  ]
 * @date 2022/11/28 20:42
 */
public class NoContext {

    private Map<String, Integer> objectMap = new HashMap<>();

    @Test
    public void test01() throws Exception{
        ResolvableType objectMap = ResolvableType.forField(NoContext.class.getDeclaredField("objectMap"));
        System.out.println(objectMap.asMap().getRawClass());
    }

    public static void main(String[] args) throws Exception{
        Field objectMap = NoContext.class.getDeclaredField("objectMap");
        TypeDescriptor descriptor = new TypeDescriptor(objectMap);
        System.out.println(descriptor.isMap());
        System.out.println(descriptor.getMapValueTypeDescriptor());
    }


}
